#ifndef COM_PARASE_DATA_H
#define COM_PARASE_DATA_H

#include "project.h"
#include "driver_usart.h"

enum CHECK_DATA_TYPE {
    CRC_CHAECK  = 0,
    SUM_CHEACK  = 1
};

typedef struct {
    uint8 head;
    uint8 len;
    std::vector<uint8> dataBuf;
    CHECK_DATA_TYPE check_type;
    uint8 check_len; // 校验位
    uint8 check0; // 校验位
    uint8 check1; // 校验位
    uint8 end;
}PARASE_BUFFER_STRUCT;

typedef int (*read_bytes_callback)(std::vector<uint8_t>& output, size_t max_bytes, int32_t timeout);


int32 com_parse_data(uint8 *dataBuf);
int32 getUsartData(uint8 *dataBuf, SerialDriver *serial, PARASE_BUFFER_STRUCT *data_structure);

#endif
